package com.dj.dal;

import com.dj.domain.entity.JobsUserAccount;

/**
 * 类UserAccountDao.java的实现描述：TODO 类实现描述
 * 
 * @author jasen.hsu.cn@gmail.com 2012-4-19 上午11:25:47
 */
public class UserAccountDao extends BaseDao<JobsUserAccount> {

    public UserAccountDao(){
        this.namespace = "jobs.single.jobsUserAccount";
    }

    /**
     * 根据用户ID取得账户信息
     * 
     * @param uid
     * @return
     */
    public JobsUserAccount loadByUid(Long uid) {
        return (JobsUserAccount) sqlMapClientTemplate.queryForObject(namespace + "." + "loadByUid", uid);
    }

    /**
     * 根据用户ID取得账户信息,并加锁
     * 
     * @param uid
     * @return
     */
    public JobsUserAccount lockByUid(Long uid) {
        return (JobsUserAccount) sqlMapClientTemplate.queryForObject(namespace + "." + "lockByUid", uid);
    }

    /**
     * 根据用户ID更新账户信息
     * 
     * @param entity
     * @return
     */
    public boolean updateByUid(JobsUserAccount entity) {
        return sqlMapClientTemplate.update(namespace + "." + "updateByUid", entity) == 1;
    }

}
